home *** CD-ROM | disk | FTP | other *** search
/ BBS Toolkit / BBS Toolkit.iso / doors_1 / cbv0150u.zip / AUTOCFG.C next >
C/C++ Source or Header  |  1992-05-15  |  3KB  |  73 lines

  1. /****************************************************************************
  2.  
  3.    This program should be used by registered WWIV sysops with modified
  4.    userrecords.  Compile this with your modified vardec.h, and run it
  5.    in your from the same directory where CBV is run from,  this can later
  6.    be used to auto-enter the values needed in CBVCFG.
  7.  
  8.    This program (AUTOCFG.C) may be freely distributed.
  9.  
  10.    !!!IF YOU HAVE SOURCE TO WWIV AND HAVE NOT REGISTERED PLEASE DO SO!!!
  11.  
  12.  ****************************************************************************/
  13.  
  14.  
  15. #include <stdio.h>
  16. #include <io.h>
  17. #include <fcntl.h>
  18. #include <dos.h>
  19. #include <stdlib.h>
  20. #include <string.h>
  21. #include "vardec.h"
  22.  
  23. typedef struct {
  24.           userreclen,                   /* length of userrec    */
  25.           offset_name,                  /* offset to name       */
  26.           offset_phone,                 /* offset to phone      */
  27.           offset_passwd,                /* offset to passwd     */
  28.           offset_note,                  /* offset to note       */
  29.           offset_sl,                    /* offset to sl         */
  30.           offset_dsl,                   /* offset to dsl        */
  31.           offset_exempt,                /* offset to exempt     */
  32.           offset_ar,                    /* offset to ar         */
  33.           offset_dar,                   /* offset to dar        */
  34.           offset_rest;                  /* offset to restrict   */
  35.         } autocfgrec;
  36.  
  37.  
  38. int         autocfgfile;                /* autoconfig file              */
  39. userrec     *user;                      /* pointer to userrec structure */
  40. autocfgrec  autocfg;                    /* convienent handle for this   */
  41.  
  42. void main()
  43.   {
  44.  
  45.     printf("This program,  autocfg,  will create a BINARY file called AUTOCFG.CBV.\n");
  46.     printf("This file can be loaded from within CBVCFG to auto-enter the values\n");
  47.     printf("needed for sysops who have modified the structure of their userrecs.\n\n");
  48.     printf("It could also be used for those sysops who just want to take that extra\n");
  49.     printf("step to guarantee that the values used by CBV are correct.\n\n");
  50.     printf("Compile (with your current vardec.h file),  and run this program from\n");
  51.     printf("the same directory where CBV is located.\n\n");
  52.     printf("If you have the source to WWIV and have not registered please do so!\n\n");
  53.  
  54.     autocfg.userreclen     = sizeof(userrec);
  55.     autocfg.offset_name    = FP_OFF(&(user->name))      - FP_OFF(user->name);
  56.     autocfg.offset_phone   = FP_OFF(&(user->phone))     - FP_OFF(user->name);
  57.     autocfg.offset_passwd  = FP_OFF(&(user->pw))        - FP_OFF(user->name);
  58.     autocfg.offset_note    = FP_OFF(&(user->note))      - FP_OFF(user->name);
  59.     autocfg.offset_sl      = FP_OFF(&(user->sl))        - FP_OFF(user->name);
  60.     autocfg.offset_dsl     = FP_OFF(&(user->dsl))       - FP_OFF(user->name);
  61.     autocfg.offset_exempt  = FP_OFF(&(user->exempt))    - FP_OFF(user->name);
  62.     autocfg.offset_ar      = FP_OFF(&(user->ar))        - FP_OFF(user->name);
  63.     autocfg.offset_dar     = FP_OFF(&(user->dar))       - FP_OFF(user->name);
  64.     autocfg.offset_rest    = FP_OFF(&(user->restrict))  - FP_OFF(user->name);
  65.  
  66.         autocfgfile = open("AUTOCFG.CBV",O_RDWR | O_CREAT | O_BINARY | O_TRUNC);
  67.         write(autocfgfile, (void *) (&autocfg), sizeof(autocfgrec));
  68.     close(autocfgfile);
  69.     printf("File AUTOCFG.CBV written to disk \n\n");
  70.   }
  71.  
  72.  
  73.